package com.xiaol.business.controller;

import org.springframework.web.bind.annotation.*;

/**
 * @PathVariable
 *      获取url中的数据
 * @RequestParam
 *      获取请求参数的值
 */
@RestController
@RequestMapping("/param")
public class ParmarController {

    @RequestMapping(value = "/requestParam")
    public String requestParam(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) {
        return "id: " + myId;
    }

    @RequestMapping(value="/pathParam/{id}", method = RequestMethod.GET)
    public String pathParam(@PathVariable("id") Integer id){
        return  "id: " + id;
    }
}
